package com.ibpd.henuocms.test;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.Set;

import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.transform.Transformers;

import com.ibpd.dao.IbpdSessionFactory;

public class testHinerbate {
	public void createSession(){
	    Date date = new Date();
	    SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyyMMdd");
	    String now_time = simpledateformat.format(date);
	    String tablename = "TBL_REPORT_STATUS_20050707";
	    tablename = "TBL_REPORT_STATUS_" + now_time;
	    try {
//	      Configuration cfg = new Configuration().add;
	      
//	      cfg.addClass(ModelEntity.class).configure();
//;	      table.setName(tablename);
//	      cfg.getClassMapping(TblReportStatus.class).setTable(table);
//	      cfg.buildSessionFactory();
	    }
	    catch (MappingException ex) {
	      ex.printStackTrace();
	    }catch (HibernateException ex) {
	      ex.printStackTrace();
	    }
	  }
	public static void main(String[] args){
//		IbpdSessionFactory.getSession().createSQLQuery("create table T_Test11(f_id numeric(10) identity not null,f_Order int null,f_ajaxUrl varchar(255) null)").executeUpdate();
		IbpdSessionFactory.getSession().createSQLQuery("insert into t_test10 (f_order,f_ajaxurl) values(1,'http://www.g.cn')").executeUpdate();
		IbpdSessionFactory.getSession().createSQLQuery("insert into t_test10 (f_order,f_ajaxurl) values(1,'http://www.g.cn')").executeUpdate();
//		Map map=(Map) IbpdSessionFactory.getSession().createSQLQuery("select * from t_test11").setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP).list().get(0);
//		Set<String> keys=map.keySet();
//		for(String key:keys){
//			System.out.println(key+"="+map.get(key));
//		}
			
	}
}
